home *** CD-ROM | disk | FTP | other *** search
/ CDV Software Presents (USA) / CDV Software Presents (USA).bin / demo / bk_demo.exe / DATA.PAK / maps / Kursk.lua < prev    next >
Encoding:
Text File  |  2003-01-16  |  12.7 KB  |  555 lines

  1. --
  2. -- Written by Vinny, also known as Udot
  3. --
  4.  
  5. function Reinforce1E()
  6.     LandReinforcement( 1);
  7.     SetSGlobalVar("temp.stack.1", "temp.objective.110");
  8. --    CheckReinf("temp.objective.110");
  9.     RunScript( "CheckReinf", 3000);
  10.     Suicide();
  11. end;
  12.  
  13. function Reinforce11E()
  14.     LandReinforcement( 11);
  15.     SetSGlobalVar("temp.stack.1", "temp.objective.111");
  16.     RunScript( "CheckReinf", 3000);
  17.     Suicide();
  18. end;
  19.  
  20. function Reinforce12E()
  21.     LandReinforcement( 12);
  22.     SetSGlobalVar("temp.stack.1", "temp.objective.112");
  23.     RunScript( "CheckReinf", 3000);
  24.     Suicide();
  25. end;
  26.  
  27. function Reinforce13E()
  28.     LandReinforcement( 13);
  29.     SetSGlobalVar("temp.stack.1", "temp.objective.113");
  30.     RunScript( "CheckReinf", 3000);
  31.     Suicide();
  32. end;
  33.  
  34. function Reinforce2E()
  35.     LandReinforcement( 2);
  36.     SetSGlobalVar("temp.stack.1", "temp.objective.120");
  37.     RunScript( "CheckReinf", 3000);
  38.     Suicide();
  39. end;
  40.  
  41. function Reinforce21E()
  42.     LandReinforcement( 21);
  43.     SetSGlobalVar("temp.stack.1", "temp.objective.121");
  44.     RunScript( "CheckReinf", 3000);
  45.     Suicide();
  46. end;
  47.  
  48. function Reinforce3E()
  49.     SetSGlobalVar("temp.stack.1", "temp.objective.130");
  50.     LandReinforcement( 3);
  51.     RunScript( "CheckReinf", 3000);
  52.     Suicide();
  53. end;
  54.  
  55. function Reinforce31E()
  56.     LandReinforcement( 31);
  57.     SetSGlobalVar("temp.stack.1", "temp.objective.131");
  58.     RunScript( "CheckReinf", 3000);
  59.     Suicide();
  60. end;
  61.  
  62. function Reinforce32E()
  63.     LandReinforcement( 32);
  64.     SetSGlobalVar("temp.stack.1", "temp.objective.132");
  65.     RunScript( "CheckReinf", 3000);
  66.     Suicide();
  67. end;
  68.  
  69. function Reinforce33E()
  70.     LandReinforcement( 33);
  71.     SetSGlobalVar("temp.stack.1", "temp.objective.133");
  72.     RunScript( "CheckReinf", 3000);
  73.     Suicide();
  74. end;
  75.  
  76. function Reinforce34E()
  77.     LandReinforcement( 34);
  78.     SetSGlobalVar("temp.stack.1", "temp.objective.134");
  79.     RunScript( "CheckReinf", 3000);
  80.     Suicide();
  81. end;
  82.  
  83. function Reinforce4E()
  84.     LandReinforcement( 4);
  85.     SetSGlobalVar("temp.stack.1", "temp.objective.140");
  86.     RunScript( "CheckReinf", 3000);
  87.     Suicide();
  88.  
  89. end;
  90.  
  91. function Reinforce41E()
  92.     LandReinforcement( 41);
  93.     SetSGlobalVar("temp.stack.1", "temp.objective.141");
  94.     RunScript( "CheckReinf", 3000);
  95.     Suicide();
  96.  
  97. end;
  98.  
  99. function Reinforce42E()
  100.     LandReinforcement( 42);
  101.     SetSGlobalVar("temp.stack.1", "temp.objective.142");
  102.     RunScript( "CheckReinf", 3000);
  103.     Suicide();
  104. end;
  105.  
  106. function Reinforce5E()
  107.     LandReinforcement( 5);
  108.     SetSGlobalVar("temp.stack.1", "temp.objective.150");
  109.     RunScript( "CheckReinf", 3000);
  110.     Suicide();
  111. end;
  112.  
  113. function Reinforce51E()
  114.     LandReinforcement( 51);
  115.     SetSGlobalVar("temp.stack.1", "temp.objective.151");
  116.     RunScript( "CheckReinf", 3000);
  117.     Suicide();
  118. end;
  119.  
  120. function Reinforce52E()
  121.     LandReinforcement( 52);
  122.     SetSGlobalVar("temp.stack.1", "temp.objective.152");
  123.     RunScript( "CheckReinf", 3000);
  124.     Suicide();
  125. end;
  126.  
  127. function CheckReinf()
  128. local strName = GetSGlobalVar("temp.stack.1", 0);
  129.     SetIGlobalVar(strName, 1);
  130.     Suicide();
  131. end;
  132.  
  133. function ReinforceUSSR1()
  134.     LandReinforcement( 100);
  135.     Suicide();
  136. end;
  137.  
  138. function ReinforceUSSR2()
  139.     LandReinforcement( 101);
  140.     Suicide();
  141. end;
  142.  
  143. function Attack1()
  144. local A_Follow = 39;
  145.     GiveCommand(A_Follow, 1, 10);
  146.  
  147.     RunScript( "Remind1", 4000);
  148.     Suicide();
  149. end;
  150.  
  151. function Attack11()
  152. local A_Follow = 39;
  153.     GiveCommand( A_Follow, 11, 110);
  154.  
  155.     RunScript( "Remind2", 4000);
  156.     Suicide();
  157. end;
  158.  
  159. function Remind1()
  160.     if ( GetNUnitsInScriptGroup(10) <= 0) then
  161.     if ( GetNUnitsInScriptGroup(1) > 0) then
  162.         Cmd(3, 1, 5500, 9700);
  163.         Suicide();
  164.     else Suicide();
  165.     end;
  166.     end;
  167. end;
  168.  
  169. function Remind2()
  170.     if ( GetNUnitsInScriptGroup(110) <= 0) then
  171.     if ( GetNUnitsInScriptGroup(11) > 0) then
  172.         Cmd(3, 11, 5500, 9700);
  173.         Suicide();
  174.     else Suicide();
  175.     end;
  176.     end;
  177. end;
  178.  
  179. function Attack12()
  180. local A_Swarm = 3;
  181.     if (GetNUnitsInScriptGroup(12) > 0) then
  182.     GiveCommand( A_Swarm, 12, 3500, 9700);
  183.     Suicide();
  184.     end;
  185. end;
  186.  
  187. function Attack13()
  188. local A_Swarm = 3;
  189.     if (GetNUnitsInScriptGroup(13) > 0) then
  190.     GiveCommand( A_Swarm, 13, 3500, 9700);
  191.     Suicide();
  192.     end;
  193. end;
  194.  
  195. function Attack2()
  196. local A_Swarm = 3;
  197.     if (GetNUnitsInScriptGroup(2) > 0) then
  198.     GiveCommand( A_Swarm, 2, 1070, 3950);
  199.     GiveQCommand( A_Swarm, 2, 3800, 5400);
  200.     GiveQCommand( A_Swarm, 2, 3700, 9500);
  201.     Suicide();
  202.     end;
  203. end;
  204.  
  205. function Attack21()
  206. local A_Swarm = 3;
  207.     if (GetNUnitsInScriptGroup(21) > 0) then
  208.     GiveCommand( A_Swarm, 21, 1070, 3950);
  209.     GiveQCommand(A_Swarm, 21, 3800, 5400);
  210.     GiveQCommand( A_Swarm, 21, 3700, 9500);
  211.     Suicide();
  212.     end;
  213. end;
  214.  
  215. function Attack3()
  216. local A_Swarm = 3;
  217.     if (GetNUnitsInScriptGroup(3) > 0) then
  218.     GiveCommand( A_Swarm, 3, 6000, 9000);
  219.     Suicide();
  220.     end;
  221. end;
  222.  
  223. function Attack31()
  224. local A_Swarm = 3;
  225.     if (GetNUnitsInScriptGroup(31) > 0) then
  226.     GiveCommand( A_Swarm, 31, 6000, 9000);
  227.     Suicide();
  228.     end;
  229. end;
  230.  
  231. function Attack32()
  232. local A_Swarm = 3;
  233.     if (GetNUnitsInScriptGroup(32) > 0) then
  234.     GiveCommand(A_Swarm, 32, 6000, 9000);
  235.     Suicide();
  236.     end;
  237. end;
  238.  
  239. function Attack33()
  240. local A_Swarm = 3;
  241.     if (GetNUnitsInScriptGroup(33) > 0) then
  242.     GiveCommand( A_Swarm, 33, 6000, 9000);
  243.     Suicide();
  244.     end;
  245. end;
  246.  
  247. function Attack34()
  248. local A_Swarm = 3;
  249.     if (GetNUnitsInScriptGroup(34) > 0) then
  250.     GiveCommand( A_Swarm, 34, 6000, 9000);
  251.     Suicide();
  252.     end;
  253. end;
  254.  
  255. function Attack4()
  256. local A_Follow = 39;
  257.     GiveCommand( A_Follow, 4, 40);
  258.  
  259.     RunScript( "Remind3", 4000);
  260.     Suicide();
  261. end;
  262.  
  263. function Remind3()
  264.     if ( GetNUnitsInScriptGroup(40) <= 0) then
  265.     if ( GetNUnitsInScriptGroup(4) > 0) then
  266.         Cmd(3, 4, 5900, 9500);
  267.         Suicide();
  268.     else Suicide();
  269.     end;
  270.     end;
  271. end;
  272.  
  273. function Attack41()
  274. local A_Swarm = 3;
  275.     if (GetNUnitsInScriptGroup(41) > 0) then
  276.     GiveCommand(A_Swarm, 41, 5900, 9500);
  277.     Suicide();
  278.     end;
  279. end;
  280.  
  281. function Attack42()
  282. local A_Swarm = 3;
  283.     if (GetNUnitsInScriptGroup(42) > 0) then
  284.     GiveCommand( A_Swarm, 42, 5900, 9500);
  285.     Suicide();
  286.     end;
  287. end;
  288.  
  289. function Attack5()
  290. local A_Follow = 39;
  291.     GiveCommand( A_Follow, 5, 50);
  292.  
  293.     RunScript( "Remind4", 4000);
  294.     Suicide();
  295. end;
  296.  
  297. function Attack51()
  298. local A_Follow = 39;
  299.     GiveCommand( A_Follow, 51, 510);
  300.  
  301.     RunScript( "Remind5", 4000);
  302.     Suicide();
  303. end;
  304.  
  305. function Remind4()
  306.     if ( GetNUnitsInScriptGroup(50) <= 0) then
  307.     if ( GetNUnitsInScriptGroup(5) > 0) then
  308.         Cmd(3, 5, 3600, 9500);
  309.         Suicide();
  310.     else Suicide();
  311.     end;
  312.     end;
  313. end;
  314.  
  315. function Remind5()
  316.     if ( GetNUnitsInScriptGroup(510) <= 0) then
  317.     if ( GetNUnitsInScriptGroup(51) > 0) then
  318.         Cmd(3, 51, 3600, 9500);
  319.         Suicide();
  320.     else Suicide();
  321.     end;
  322.     end;
  323. end;
  324.  
  325. function Attack52()
  326. local A_Swarm = 3;
  327.     if (GetNUnitsInScriptGroup(52) > 0) then
  328.         GiveCommand(A_Swarm, 52, 3600, 9500);
  329.         Suicide();
  330.     end;
  331. end;
  332.  
  333. function ToWin()
  334.     if ( (GetIGlobalVar("temp.Kursk.objective.0", 0) * GetIGlobalVar("temp.Kursk.objective.6", 0)) == 1) then
  335.         RunScript( "RevealObjective7", 3000);
  336.         RunScript( "WinWin", 8000);
  337.         Suicide();
  338.     end;
  339. end;
  340.  
  341. function WinWin()
  342.     Win(0);
  343.     Suicide();
  344. end;
  345.  
  346. function TobeDefeated()
  347.     if (GetNUnitsInScriptGroup(1000, 0) <= 0) then
  348.         Loose();
  349.         Suicide();
  350.     end;
  351. end;
  352.  
  353. function Objective0()
  354.     if ( (GetIGlobalVar("temp.Kursk.objective.1", 0) * GetIGlobalVar("temp.Kursk.objective.2", 0) * GetIGlobalVar("temp.Kursk.objective.3", 0) *
  355.       GetIGlobalVar("temp.Kursk.objective.4", 0) * GetIGlobalVar("temp.Kursk.objective.5", 0)) == 1) then
  356.         SetIGlobalVar("temp.Kursk.objective.0", 1);
  357.  
  358.         ObjectiveChanged(0, 1);
  359.  
  360.         RunScript( "RevealObjective6", 5000);
  361.         Suicide();
  362.     end;
  363. end;
  364.  
  365. function Objective1()
  366.     if ((GetIGlobalVar("temp.objective.110",0) * GetIGlobalVar("temp.objective.120",0) * GetIGlobalVar("temp.objective.130",0) *
  367.       GetIGlobalVar("temp.objective.150",0)) == 1) then
  368.  
  369.     local num = GetNUnitsInScriptGroup(10) + GetNUnitsInScriptGroup(1) + GetNUnitsInScriptGroup(2) + GetNUnitsInScriptGroup(3) + GetNUnitsInScriptGroup(50) +
  370.       GetNUnitsInScriptGroup(5);
  371.     if (num <= 3) then
  372.         SetIGlobalVar("temp.Kursk.objective.1", 1);
  373.         ObjectiveChanged(1, 1);
  374.         Suicide();
  375.     end;
  376.     end;
  377. end;
  378.  
  379. function Objective2()
  380.     if ((GetIGlobalVar("temp.objective.111",0) * GetIGlobalVar("temp.objective.131",0) * GetIGlobalVar("temp.objective.140",0) *
  381.       GetIGlobalVar("temp.objective.151",0)) == 1) then
  382.  
  383.     local num = GetNUnitsInScriptGroup(11) + GetNUnitsInScriptGroup(110) + GetNUnitsInScriptGroup(31) + GetNUnitsInScriptGroup(4) + GetNUnitsInScriptGroup(51) +
  384.       GetNUnitsInScriptGroup(40) + GetNUnitsInScriptGroup(510);
  385.     if (num <= 3) then
  386.         SetIGlobalVar("temp.Kursk.objective.2", 1);
  387.           ObjectiveChanged(2, 1);
  388.         Suicide();
  389.     end;
  390.     end;
  391. end;
  392.  
  393. function Objective3()
  394.     if ((GetIGlobalVar("temp.objective.112",0) * GetIGlobalVar("temp.objective.132",0) * GetIGlobalVar("temp.objective.141",0)) == 1) then
  395.  
  396.     local num = GetNUnitsInScriptGroup(12) + GetNUnitsInScriptGroup(32) + GetNUnitsInScriptGroup(41);
  397.     if (num <= 1) then
  398.         SetIGlobalVar("temp.Kursk.objective.3", 1);
  399.         ObjectiveChanged(3, 1);
  400.         Suicide();
  401.     end;
  402.     end;
  403. end;
  404.  
  405. function Objective4()
  406.     if ((GetIGlobalVar("temp.objective.121",0) * GetIGlobalVar("temp.objective.133",0) * GetIGlobalVar("temp.objective.152",0)) == 1) then
  407.  
  408.     local num = GetNUnitsInScriptGroup(21) + GetNUnitsInScriptGroup(33) + GetNUnitsInScriptGroup(52);
  409.     if (num <= 1) then
  410.         SetIGlobalVar("temp.Kursk.objective.4", 1);
  411.         ObjectiveChanged(4, 1);
  412.         Suicide();
  413.     end;
  414.     end;
  415. end;
  416.  
  417. function Objective5()
  418.     if ((GetIGlobalVar("temp.objective.113",0) * GetIGlobalVar("temp.objective.134",0) * GetIGlobalVar("temp.objective.142",0)) == 1) then
  419.  
  420.     local num = GetNUnitsInScriptGroup(13) + GetNUnitsInScriptGroup(34) + GetNUnitsInScriptGroup(42);
  421.     if (num <= 0) then
  422.         SetIGlobalVar("temp.Kursk.objective.5", 1);
  423.         ObjectiveChanged(5, 1);
  424.         Suicide();
  425.     end;
  426.     end;
  427. end;
  428.  
  429. function Objective6()
  430. local num = GetNUnitsInScriptGroup(99, 1);
  431.     if (num <= 0) then
  432.         SetIGlobalVar("temp.Kursk.objective.6", 1);
  433.         ObjectiveChanged(6, 1);
  434.  
  435.         Suicide();
  436.     end;
  437. end;
  438.  
  439. function RevealObjective0()
  440.     ObjectiveChanged(0, 0);
  441.     Suicide();
  442. end;
  443.  
  444. function RevealObjective1()
  445.     if ( GetIGlobalVar("temp.Kursk.objective.1", 0) == 0) then
  446.         ObjectiveChanged(1, 0);
  447.     end;
  448.     Suicide();
  449. end;
  450.  
  451. function RevealObjective2()
  452.     if ( GetIGlobalVar("temp.Kursk.objective.2", 0) == 0) then
  453.         ObjectiveChanged(2, 0);
  454.     end;
  455.     Suicide();
  456. end;
  457.  
  458. function RevealObjective3()
  459.     if ( GetIGlobalVar("temp.Kursk.objective.3", 0) == 0) then
  460.         ObjectiveChanged(3, 0);
  461.     end;
  462.     Suicide();
  463. end;
  464.  
  465. function RevealObjective4()
  466.     if ( GetIGlobalVar("temp.Kursk.objective.4", 0) == 0) then
  467.         ObjectiveChanged(4, 0);
  468.     end;
  469.     Suicide();
  470. end;
  471.  
  472. function RevealObjective5()
  473.     if ( GetIGlobalVar("temp.Kursk.objective.5", 0) == 0) then
  474.         ObjectiveChanged(5, 0);
  475.     end;
  476.     Suicide();
  477. end;
  478.  
  479. function RevealObjective6()
  480.     if ( GetIGlobalVar("temp.Kursk.objective.6", 0) == 0) then
  481.         ObjectiveChanged(6, 0);
  482.     end;
  483.     Suicide();
  484. end;
  485.  
  486. function RevealObjective7()
  487.     if ( GetIGlobalVar("temp.Kursk.objective.7", 0) == 0) then
  488.         ObjectiveChanged(7, 0);
  489.     end;
  490.     Suicide();
  491. end;
  492.  
  493.  
  494. function Init()
  495.  -- 1
  496.     RunScript( "RevealObjective1", 8000);
  497.     RunScript( "Reinforce1E", 10000);
  498.     RunScript( "Reinforce2E", 15000);
  499.     RunScript( "Reinforce3E", 20000);
  500.     RunScript( "Reinforce5E", 25000);
  501.      RunScript( "Attack1", 12000);
  502.     RunScript( "Attack2", 17000);
  503. --    RunScript( "Attack3", 17000);
  504.      RunScript( "Attack5", 27000);
  505. -- 2
  506.     RunScript( "RevealObjective2", 220000);
  507.     RunScript( "Reinforce11E", 300000);
  508.     RunScript( "Reinforce31E", 266000);
  509.     RunScript( "Reinforce4E", 210000);
  510.     RunScript( "Reinforce51E", 320000);
  511.     RunScript( "Attack11", 301000);
  512. --    RunScript( "Attack31", 267000);
  513.     RunScript( "Attack4", 211000);
  514.     RunScript( "Attack51", 321000);
  515. -- 3
  516.     RunScript( "RevealObjective3", 450000);
  517.     RunScript( "Reinforce12E", 460000);
  518.     RunScript( "ReinforceUSSR1", 440000);
  519.     RunScript( "Reinforce32E", 500000);
  520.     RunScript( "Reinforce41E", 480000);
  521.     RunScript( "Attack12", 461000);
  522. --    RunScript( "Attack32", 501000);
  523.     RunScript( "Attack41", 481000);
  524. -- 4
  525.     RunScript( "RevealObjective4", 690000);
  526.     RunScript( "Reinforce21E", 690000);
  527.     RunScript( "Reinforce33E", 680000);
  528.     RunScript( "Reinforce52E", 720000);
  529.     RunScript( "Attack21", 691000);
  530. --    RunScript( "Attack33", 681000);
  531.     RunScript( "Attack52", 721000);
  532. -- 5
  533.     RunScript( "RevealObjective5", 910000);
  534.     RunScript( "ReinforceUSSR2", 1000000);
  535.     RunScript( "Reinforce13E", 950000);
  536.     RunScript( "Reinforce34E", 900000);
  537.     RunScript( "Reinforce42E", 930000);
  538.     RunScript( "Attack13", 951000);
  539. --    RunScript( "Attack34", 901000);
  540.     RunScript( "Attack42", 931000);
  541.  
  542.     RunScript( "TobeDefeated", 6000);
  543.  
  544.     RunScript( "RevealObjective0", 3000); -- "u must defend"
  545.  
  546.     RunScript( "Objective0", 2000);
  547.     RunScript( "Objective1", 2000);
  548.     RunScript( "Objective2", 2000);
  549.     RunScript( "Objective3", 2000);
  550.     RunScript( "Objective4", 2000);
  551.     RunScript( "Objective5", 2000);
  552.     RunScript( "Objective6", 2000);
  553.     RunScript( "ToWin", 2000);
  554. end;
  555.